HJS

Nginx 개념 및 기본 설정

1️⃣ NGINX란?

NGINX는 웹 서버이자 리버스 프록시, 로드 밸런서 등의 역할을 수행하는 고성능 서버 소프트웨어입니다.

🔹 NGINX vs Apache



2️⃣ NGINX 설치 및 기본 명령어

1. NGINX 설치 (Ubuntu 기준)

sudo apt update
sudo apt install nginx -y

2. NGINX 기본 명령어



3️⃣ /etc/nginx/nginx.conf 기본 구조 분석

NGINX 설정 파일(/etc/nginx/nginx.conf)의 주요 구조는 다음과 같습니다.

user www-data;
worker_processed auto;
error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
        listen 80;
        server_name example.com;

        location / {
            root /var/www/html;
            index index.html index.htm;
        }
    }
}

🔹 주요 디렉티브